<template>
    <div class="contant">
        <div class="title">
            {{newsinfo.title}}
        </div>
        <div class="subtitle">
            <div class="time">
                发表时间{{newsinfo.add_time}}
            </div>
            <div class="clicknum">
                点击次数{{newsinfo.click}}
            </div>
        </div>
        <div>
            <h1>这里是内容但是我没做</h1>
        </div>
        <div>
            <comment></comment>
        </div>
    </div>
</template>

<script>
    import comment from '../subcomponents/comment.vue'
    export default {
        data() {
            return {
                id: this.$route.params.id,
                newsinfo: {}
            }
        },
        methods: {
            getnewsinfo() {
                this.$http.get('getnewslist').then(res => {
                    this.newsinfo = res.body.splice(this.id, 1)[0]
                })
            }
        },
        created() {
            this.getnewsinfo()
        },
        components:{
            comment
        }
    }
</script>

<style scoped lang="scss">
    .contant {
        padding: 5px;

        .title {
            font-weight: 700;
            color: red;
        }

        .subtitle {
            display: flex;
            justify-content: space-between;
            color: #26A2FF;
            padding: 10px 0;
            border-bottom: 1px solid #D7D8D6;
        }
    }
</style>